Skip to content

Instantly share code, notes, and snippets.

@epok07
epok07 / CarbonCheatSheet_01.md
Last active May 10, 2024 01:21
Carbon CheatSheet

Source

Get the first Monday of a month (and more)

This is a small cheat sheet for PHP's strtotime function, which can be used to convert textual sentences such as "next Friday" and "last Monday" into UNIX timestamps and formatted dates.

In the examples below, I've used the format "j, d-M-Y", which will give you something like: Monday, 17-Aug-2015. You can change this to your format of choice

@nikAizuddin
nikAizuddin / NASMx86: Allocate heap memory
Created October 12, 2014 22:58
Example using brk() system call for dynamic memory allocations
; 1 2 3 4 5 6 7
;01234567890123456789012345678901234567890123456789012345678901234567890
;=======================================================================
;+---------------------------------------------------------------------+
;| |
;| Example using brk() system call for dynamic memory allocations. |
;| |
;| DON'T CONFUSE that brk() used in C Function is different with brk() |
;| systemcall (systemcall 45 for x86 ASM). |
;| |
@vy-let
vy-let / configuration.nix
Created July 4, 2020 04:16
Setting up NixOS for typical home SMB file sharing
...
{
services.samba = {
enable = true;
syncPasswordsByPam = true;
# You will still need to set up the user accounts to begin with:
# $ sudo smbpasswd -a yourusername
@dsparks
dsparks / Avoiding a loop.R
Created September 12, 2012 13:19
lapply() as an alternative to a multiply-nested loop
# Alternative to a doubly-nested loop
# Imagine I want to perform an operation on a data frame
# once for each combination of two variables, such as Country and Year
# I can do this with a nested loop, or I can do this with (among other
# things) lapply()
# Generate random data:
allCountries <- LETTERS[1:10]
allYears <- 1990:2012
@AndrewMast
AndrewMast / disable_vanguard.vbs
Last active May 10, 2024 01:10
Commands to disable Riot Vanguard when you aren't playing Valorant
' Disables Vanguard from starting when you boot your computer
Call CreateObject("Shell.Application").ShellExecute("cmd.exe", "/c ""sc config vgc start= disabled & sc config vgk start= disabled""", "", "runas")
@lyc8503
lyc8503 / Bilibili共享大会员.user.js
Last active May 10, 2024 01:09
和朋友共享 Bilibili 大会员账号
// ==UserScript==
// @name Bilibili VIP
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 不给叔叔送钱
// @author You
// @match *://www.bilibili.com/bangumi/play/*
// @match *://www.bilibili.com/video/*
// @connect api.bilibili.com
// @icon https://www.bilibili.com/favicon.ico
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 10, 2024 01:06
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@CaesarOG
CaesarOG / !LaTeX.MD
Last active May 10, 2024 01:06
LaTeX w/ VimTex, UltiSnips and Zathura
@crazy4groovy
crazy4groovy / js-utils.js
Last active May 10, 2024 01:04
Misc useful utils (JavaScript)
export const assign = (...objs) => Object.assign({}, ...objs)
export const assign2 = (...objs) => {
objs.unshift({});
let len = objs.length;
while (--len > 0)
for (let i in objs[len])
objs[0][i] = objs[len][i]
return objs[0]
}
// no spread operator overhead, raw arguments access, obj[0] *is* mutated!
I'm working on a way to connect data to a user interface
in a way that is flexible,
yet still easy for end-users to work with.
This has been one of the biggest challenges for me.
## References:
* https://hackernoon.com/how-to-decouple-state-and-ui-a-k-a-you-dont-need-componentwillmount-cc90b787aa37
* https://webpack.js.org/guides/code-splitting/